class Project < ActiveRecord::Base
  has_many :expenses, :dependent => :delete_all

  def total_expenses
    expenses.sum(:amount)
  end
  def min_expense
    expenses.minimum(:amount)
  end
  def max_expense
    expenses.maximum(:amount)
  end
  def avg_expense
    expenses.average(:amount)
  end
end
